using System;
using System.Configuration;
using System.Web;
using Social.YouTube;

namespace Logic.Social
{
	public class YouTubeConfig : IYouTubeConfig
	{
		public string DeveloperKey
		{
			get { return ConfigurationManager.AppSettings["youtube_devKey"]; }
		}

		public string AppName
		{
			get { return ConfigurationManager.AppSettings["youtube_appName"]; }
		}

		public string SessionToken
		{
			get
			{
				var cookie = HttpContext.Current.Request.Cookies["youtube_token"];
				return cookie == null ? null : cookie.Value;
			}
			set { HttpContext.Current.Response.Cookies.Add(new HttpCookie("youtube_token", value) { Expires = DateTime.Now.AddDays(1) }); }
		}

		public string CallbackUrl
		{
			get { return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + "/Auth.aspx?from=youtube"; }
		}

		public string HostedDomain
		{
			get { return ConfigurationManager.AppSettings["youtube_hostedDomain"]; }
		}
	}
}